package com.sakura.stock.controller;
import com.sakura.stock.servie.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/stock")
public class StockController {

    @Value("${server.port}")
    String port;

    @Autowired
    StockService stockService;

    @RequestMapping("/reduct")
    public String reduct(){
//        int a = 1/0;
        System.out.println("扣减库存");
        return "扣减库存，服务端口：" + port;
    }
    @GetMapping("/getProductNum/{productNo}")
    public Integer getProductNum(@PathVariable("productNo") String productNo){
        return stockService.getProductNum(productNo);
    }
}
